import { BundleMgr } from "./mgr/BundleMgr";
import { ConfigMgr } from "./mgr/ConfigMgr";
import { EventMgr } from "./mgr/EventMgr";
import { GameLogic } from "./mgr/GameLogic";
import { LoadingMgr } from "./mgr/LoadingMgr";
import { ResMgr } from "./mgr/ResMgr";
import { TimerMgr } from "./mgr/TimerMgr";
import { ViewMgr } from "./mgr/ViewMgr";

import {_decorator} from "cc";

const {ccclass} = _decorator;

@ccclass("App")
export class App {
    static gameLogic: GameLogic = new GameLogic();
    static viewMgr: ViewMgr = new ViewMgr();
    static bundleMgr: BundleMgr = new BundleMgr();
    static eventMgr: EventMgr = new EventMgr();
    static timerMgr: TimerMgr = new TimerMgr();
    static loadingMgr: LoadingMgr = new LoadingMgr(App.gameLogic);
    static resMgr: ResMgr = new ResMgr();
    static configMgr: ConfigMgr = new ConfigMgr();

    static init(): void {
        const arr = [
            this.viewMgr,
            this.bundleMgr,
            this.eventMgr,
            this.timerMgr,
            this.loadingMgr
        ]

        for (const r of arr) {
            r.init();
        }

    }

    static finit(): void {

    }

    static start(): void {
        App.loadingMgr.startLoading();
    }

}